<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.mfp.java.testYou.core.servlets.TakeTestServlet" %>
<%@ page import="com.mfp.java.testYou.ui.mvc.ResultsPage" %>
<%@ page import="com.mfp.java.testYou.ui.mvc.UserMenuPage" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="tU" %>
<%@page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>

<%@include file="../global/global.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%UserMenuPage userMenuPage = new UserMenuPage(request, response);%>
<c:set var="userMenuPage" value="<%=userMenuPage%>"/>
<html>
<head>
    <jsp:include page="../components/htmlHeader.jsp"></jsp:include>
    <title><testU:i18n>usermenu.title</testU:i18n></title>
    <script language="JavaScript" src="<%=cPath%>/testYou/resources/validations.js">
    </script>
</head>
<body class="bgColor textColor">
<jsp:include page="../components/header.jsp"/>

<table class="centerTable30marg width40">

    <tr>
        <td>
            <testU:studentOnly>
                <ul class="liHor fontMenu padLeft35">
                    <li>
                        <a href="<%=cPath%><%=response.encodeRedirectURL(TakeTestServlet.URL)%>?fromMenu=true">
                            <testU:i18n>navi.takeTest</testU:i18n>
                        </a>
                    </li>
                    <li>
                        <c:set var="inProgress" value="${userMenuPage.hasCurrentTest()}"/>
                        <c:set var="urlContTest" value="<%=cPath + response.encodeRedirectURL(userMenuPage.getContTestUrl())%>"/>
                        <c:choose>
                            <c:when test="${inProgress}">
                                <a href="${urlContTest}"><testU:i18n>navi.contTest</testU:i18n></a>
                            </c:when>
                            <c:otherwise>
                                <div class="textColorDisable"><testU:i18n>navi.contTest</testU:i18n></div>
                            </c:otherwise>
                        </c:choose>
                    </li>
                    <li>
                        <a href="<%=cPath%><%=response.encodeRedirectURL(ResultsPage.URL)%>">
                            <testU:i18n>navi.results</testU:i18n>
                        </a>
                    </li>
                </ul>
            </testU:studentOnly>
        </td>
    </tr>

    <tr>

        <td class="padTop50px">
            <c:if test="${inProgress}">
                <div class="alignCenter"><testU:i18n>userMenu.continueMessage</testU:i18n></div>
            </c:if>

        </td>

    </tr>
    <tr>
        <td class="padTop50px">
            <c:if test="${!inProgress}">
                <div class="alignCenter"><testU:i18n>userMenu.welcomeMessage</testU:i18n></div>
            </c:if>
        </td>
    </tr>

</table>

<c:if test="${sessionScope.fromMenu}">
    <form action="<%=cPath%><%=response.encodeURL(TakeTestServlet.URL)%>" method="post" name="startTest">
        <input type="hidden" name="<%=TakeTestServlet.OPERATION%>" value="<%=TakeTestServlet.OPERATION_START_TEST%>"/>
        <table class="centerTable30marg width40 alignCenter">
            <tbody>
            <tr>
                <td>
                    <tU:selectListComponent validate="true" editButtonId="startTest" formName="startTest" />

                </td>
            </tr>
            <tr>
                <td>
                    <input type="submit" value='<testU:i18n>userMenu.startTest</testU:i18n>' id="startTest" disabled="disabled"/>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</c:if>

</body>
</html>